package com.lwww.infinitechat.authenticationservice.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.lwww.infinitechat.authenticationservice.data.user.login.LoginRequest;
import com.lwww.infinitechat.authenticationservice.data.user.login.LoginResponse;
import com.lwww.infinitechat.authenticationservice.data.user.register.RegisterRequest;
import com.lwww.infinitechat.authenticationservice.data.user.register.RegisterResponse;
import com.lwww.infinitechat.authenticationservice.data.common.upload.UploadUrlRequest;
import com.lwww.infinitechat.authenticationservice.data.common.upload.UploadUrlResponse;
import com.lwww.infinitechat.authenticationservice.data.user.updateAvatar.UpdateAvatarRequest;
import com.lwww.infinitechat.authenticationservice.data.user.updateAvatar.UpdateAvatarResponse;
import com.lwww.infinitechat.authenticationservice.model.User;

public interface UserService extends IService<User> {

    default User getOnlyUser(QueryWrapper<User> wrapper,boolean throwEx){
        wrapper.last("limit 1");
        return this.getOne(wrapper,throwEx);
    }

    /**
     * 用户注册
     * @param request
     * @return
     */
    RegisterResponse register(RegisterRequest request);


    /**
     * 用户密码登录
     * @param request
     * @return
     */
    LoginResponse loginByPassword(LoginRequest request);

    /**
     * 用户验证码登录
     * @param request
     * @return
     */
    LoginResponse loginByCode(LoginRequest request);

    /**
     * 用户退出
     * @param userId
     */
    void logout(String userId);

    /**
     * 用户获取OSS预授权上传链接
     * @param request
     * @return
     */
    UploadUrlResponse uploadUrl(UploadUrlRequest request) throws Exception;

    /**
     * 更新用户头像
     * @param
     * @param
     */
    UpdateAvatarResponse updateAvatar(UpdateAvatarRequest request, String uerId);


}
